/*define(["jquery","config"],function($){
	
	function Header(){
		this.load();
	}
	
	Header.prototype = {
		constructor:Header,*/
		
		
		/*加载头部和尾部*/
		/*load:function(){
			//头部
			$.get("/html/include/header.html" , $.proxy(this.headerHandler , this));
			
			//尾部
			$("footer").load("/html/include/footer.html");
			
			$.ajax("http://rap2api.taobao.org/app/mock/104562/example/1539938684978")
					.done(function(data){
						var data = {list: data.res_body.list};
						console.log(data);
						var html = template("submenu-template" , data);
						
						$("#submenu-list").html(html);
					});
			
		},
		
		headerHandler:function(data){
			$("header").html(data);
			this.addListener();
		},
		//注册监听事件
		
		addListener : function(){
			$(".af-tea").mouseenter(this.navEnter);
			console.log($(".af-tea"));
			$("#submenu-list").mouseleave(this.navLeave);
			$(".car_box").click();
		},
		
		toshoppingCar : function(){
			window.location("/html/cart.html");
		},
		navEnter : function(){
			$("#submenu-list").show();
		},
		
		navLeave : function(){
			$("#submenu-list").hide();
		}
		
	}	
	new Header();
});
*/

require(["config"],function(){
	require(["jquery","template","header","carousel"],function($,template){
		function Header() {
			this.load();
			this.addListener();
		}
		
		$.extend(Header.prototype,{
			load:function(){
				//头部
				$.get("/html/include/header.html" , $.proxy(this.headerHandler , this));
				
				//尾部
				$("footer").load("/html/include/footer.html");
				
				$.ajax("http://rap2api.taobao.org/app/mock/104562/example/1539938684978")
						.done(function(data){
							var data = {list: data.res_body.list};
							console.log(data);
							var html = template("submenu-template" , data);
							
							$("#submenu-list").html(html);
						});
			},
			headerHandler:function(data){
				$("header").html(data);
				this.addListener();
			},
			//注册监听事件
			
			addListener : function(){
				$(".af-tea").mouseenter(this.navEnter);
				$(".sd-son").mouseenter(this.navEnter);
				$(".sd-parent").mouseenter(this.navEnter);
				$(".sd-friend").mouseenter(this.navEnter);
				$(".sd-lover").mouseenter(this.navEnter);
				console.log($(".af-tea"));
				$("#submenu-list").mouseleave(this.navLeave);
				$(".car_box").click();
			},
			
			toshoppingCar : function(){
				window.location("/html/cart.html");
			},
			navEnter : function(){
				$("#submenu-list").show();
				console.log($(this).children("a"));
				$(this).children("a").attr("color","#01D5D8");
				
			},
			
			navLeave : function(){
				$("#submenu-list").hide();
			}
			
		});
		new Header();
	});
});
	//引入依赖模块
	
		
